﻿using HttpPlugin;
using Newtonsoft.Json;
using SMes.DbMethod.ViewModel;

namespace SMes.DbMethod.Http
{
    /// <summary>
    /// SendMesDataToPlc写入数据值至设备
    /// </summary>
    /// <param name="smesHttpClients"></param>
    public class SendMesDataToPlc(IHttpSend smesHttpClients)
    {
        private IHttpSend _smesHttpClients = smesHttpClients;

        public async Task<string> SendManydatasToPlc(List<DriverAddressModel> driverAddressModels)
        {          
            string data = JsonConvert.SerializeObject(driverAddressModels);
            var result = await _smesHttpClients.SendPost("api/mdc/Push/WriteManyValueToPlc", data);
            return result;
        }
        public async Task<string> SendOnedatasToPlc(DriverAddressModel driverAddressModels)
        {
            string data = JsonConvert.SerializeObject(driverAddressModels);
            var result = await _smesHttpClients.SendPost("api/mdc/Push/WriteValueToPlc", data);
            return result;
        }
    }
}
